﻿package net.jmp0.toast.entities.obstacles 
{
	import net.jmp0.toast.entities.bases.GameElement;
	import net.jmp0.toast.entities.obstacles.Obstacle;
	
	/**
	 * ...
	 * @author Thodd
	 */
	public class GameKey extends Obstacle
	{
		[Embed(source = '../../res/key.png')] private var imgSprite:Class;
		
		private var amount:int = 1;
		
		public function GameKey(x:int, y:int, amount:int) {
			super(x, y);
			
			this.amount = amount;
			
			//Standard setup stuff
			this.sprite = FP.getSprite(imgSprite, 20, 20, false, false, 0, 0, true);
			this.randomizeAnimation();	
		}
		
		public function getAmount():int {
			return amount;
		}
		
		override public function performCollision(colPartner:GameElement):void {
			//by default the collision partner is just passing through
			//the player may pickup the key, this is implemented in the player class
			colPartner.lastCollision = this;
			colPartner.xSpeed = colPartner.oldXspeed;
			colPartner.ySpeed = colPartner.oldYspeed;
		}
		
	}

}